from flask import Flask
from settings import dev
from apps.user.view import user_bp
from apps.admin.view import admin_bp
from exts import db


def create_app():
    app = Flask(__name__, template_folder='../templates', static_folder='../static')
    app.config.from_object(dev.DevConfig)
    # 蓝图注册
    app.register_blueprint(user_bp)
    app.register_blueprint(admin_bp)
    # db初始化
    db.init_app(app=app)
    # key
    app.secret_key = 'lfsakhfnednddswfdddlasdjmcls'
    return app
